/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once


#include "ui容器部件.h"
#include "UI/ui绘制模板.h"



typedef struct {
	S_2D文本对象	m_文本对象;

	uint16 m_变换ID;
	uint16 m_颜色ID;
	uint16 m_文字ID;
	uint16 m_元素ID;

}S_列表框GPU参数ID;


typedef struct {
	mat3X2* m_变换ID;
	uint32* m_颜色ID;
	uint32* m_文字ID;

	mat3X2* m_ICO变换;
	uint32* m_ICO颜色;
	float32* m_ICO_uv;
}S_列表框GPU参数指针;








class C_列表框 : public C_Widget {
	
	E_列表显示模式	m_列表显示模式;
public:
	C_列表框(S_UI创建环境& ctx, uint8 列数量, E_列表显示模式 模式);
	~C_列表框();

	//S_View属性	m_View属性;
	uint32		m_行高度;
	uint32		m_列数;

	S_列表框GPU参数ID		m_GPU参数ID;
	ui_绘制模板_画预设图形	m_背景绘制;
	ui_绘制模板_画预设图形	m_当前选项焦点绘制;
	ui_绘制模板_行文本绘制	m_文字绘制;
	ui_绘制模板_图标		m_图标绘制;


	std::vector<S_列表填充数据>		m_列表数据;

	std::vector<uint32>				m_当前选中项;
	bool							m_是否多选;
	fp_列表项选中回调_str			mf_项选中回调;

	void f_填充列表(std::vector<S_列表填充数据>& data);
	C_Widget* f_addItem(const S_列表填充数据& data, uint32 offset);
	void f_delItem(S_列表填充数据& data, uint32 offset);
	void f_clearItem();

	std::vector<std::string> f_构建选中文件(std::string root);

private:

};







class C_下拉列表框 : public C_Widget {

public:
	C_下拉列表框(S_UI创建环境& ctx, bool 可编辑 = true);
	~C_下拉列表框();

	S_Props		m_列表项;

	ui_绘制模板_画预设图形	m_背景绘制;
	ui_绘制模板_图标		m_图标绘制;

	C_Widget*	m_文本编辑框;
	C_列表框*	m_列表;
	C_Widget*	m_移除项按钮;
	C_Widget*	m_列表视口;
	fp_PropUpdate	mf_添加项;
	fp_PropUpdate	mf_移除项;

	void f_绑定列表数据(S_Props& prop);

};












